﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CosView.GUI
{
    class CosForm
    {
        public ConsoleColor ForeColor = ConsoleColor.Black, BorderColor = ConsoleColor.Gray, BackgroundColor = ConsoleColor.White, TitleFore = ConsoleColor.White, TitleBack = ConsoleColor.Red;
        public int Width = 4, Height = 3, X = 1, Y = 1;
        public string Text = "";
        public string ContentText = "";
        public event EventHandler Paint;

        protected void OnPaint()
        {
            DrawerObject Titl = new DrawerObject(X + Width, Y + 1, X, Y, TitleBack, TitleFore);
            Titl.Text = Text;
            Drawer.AddObject(Titl);
            DrawerObject Cont = new DrawerObject(X + Width, Height, X, Y + 1, BackgroundColor, BackgroundColor);
            Cont.Text = ContentText;
            DrawerObject Bott = new DrawerObject(X + Width, Y + Height + 1, X, Y + Height, BorderColor, BorderColor);

            /*Bar bar1 = new Bar(0, 3, 20, 4);
            bar1.Text = "Bar1";
            bar1.IsActive = false;
            Bar bar2 = new Bar(0, 4, 20, 5);
            bar2.Text = "Bar2";
            bar2.IsActive = true;
            Bar bar3 = new Bar(0, 5, 20, 6);
            bar3.Text = "Bar3";
            bar3.IsActive = false;*/

            Drawer.AddObject(Cont);
            /*Drawer.AddObject(bar1);
            Drawer.AddObject(bar2);
            Drawer.AddObject(bar3);*/
            Drawer.AddObject(Bott);
            Drawer.Invalidate();

            if (Paint != null) Paint(this, EventArgs.Empty);
        }

        public void Invalidate()
        {
            OnPaint();
        }
    }
}
